package com.yuedao.sender.model1;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

/**
 * Created with IntelliJ IDEA
 * User: z
 * DATE: 2018/8/20
 * TIME: 2018-08-20
 * Description:
 */
@Entity
@Table(name = "ydx_voucher")
public class VoucherEntity {
    private int id;
    private String name;
    private String getFrom;
    private Timestamp validFrom;
    private Timestamp validTo;
    private Integer forOrderTypeId;
    private int value;
    private String imageUrl;
    private Integer isActive;

    //新增字段
    private Double discount;
    private Integer voucherType;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "get_from")
    public String getGetFrom() {
        return getFrom;
    }

    public void setGetFrom(String getFrom) {
        this.getFrom = getFrom;
    }

    @Basic
    @Column(name = "valid_from")
    public Timestamp getValidFrom() {
        return validFrom;
    }

    public void setValidFrom(Timestamp validFrom) {
        this.validFrom = validFrom;
    }

    @Basic
    @Column(name = "valid_to")
    public Timestamp getValidTo() {
        return validTo;
    }

    public void setValidTo(Timestamp validTo) {
        this.validTo = validTo;
    }


    @Basic
    @Column(name = "for_order_type_id")
    public Integer getForOrderTypeId() {
        return forOrderTypeId;
    }

    public void setForOrderTypeId(Integer forOrderTypeId) {
        this.forOrderTypeId = forOrderTypeId;
    }

    @Basic
    @Column(name = "value")
    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    @Basic
    @Column(name = "image_url")
    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    @Basic
    @Column(name = "is_active")
    public Integer getIsActive() {
        return isActive;
    }

    public void setIsActive(Integer isActive) {
        this.isActive = isActive;
    }

    @Basic
    @Column(name = "discount")
    public Double getDiscount() {
        return discount;
    }

    public void setDiscount(Double discount) {
        this.discount = discount;
    }

    @Basic
    @Column(name = "voucher_type")
    public Integer getVoucherType() {
        return voucherType;
    }

    public void setVoucherType(Integer voucherType) {
        this.voucherType = voucherType;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        VoucherEntity that = (VoucherEntity) o;
        return id == that.id &&
                forOrderTypeId == that.forOrderTypeId &&
                value == that.value &&
                Objects.equals(name, that.name) &&
                Objects.equals(getFrom, that.getFrom) &&
                Objects.equals(validFrom, that.validFrom) &&
                Objects.equals(validTo, that.validTo) &&
                Objects.equals(imageUrl, that.imageUrl) &&
                Objects.equals(isActive, that.isActive)
               ;
    }

    @Override
    public int hashCode() {

        return Objects.hash(id, name, getFrom, validFrom, validTo, forOrderTypeId, value, imageUrl, isActive);
    }
}
